<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateSystemPermissionTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('system_permission', function (Blueprint $table) {
            $table->increments('id')->comment('ID');
            $table->integer('pid')->default(0)->comment('上级id');
            $table->string('title',30)->comment('标题');
            $table->string('icon',30)->default('el-icon-setting')->comment('图标');
            $table->string('route',100)->default('/')->comment('前端路由');
            $table->string('component',50)->default('Layout')->comment('前端组件');
            $table->string('controller',30)->default('#')->comment('请求控制器');
            $table->string('action',20)->default('#')->comment('请求方法');
            $table->string('target',10)->default('_self')->comment('跳转方式');
            $table->integer('sort')->default(99)->comment('排序');
            $table->string('remark',255)->nullable()->comment('备注');
            $table->tinyInteger('status')->default(1)->comment('状态');
            $table->tinyInteger('is_menu')->default(0)->comment('是否是菜单');
            $table->dateTime('created_at')->nullable()->comment('创建时间');
            $table->dateTime('updated_at')->nullable()->comment('更新时间');
            $table->dateTime('deleted_at')->nullable()->comment('删除时间');
            $table->comment('系统权限表');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('system_permission');
    }
}
